package jp.co.hcs.attendancemanagement;

import org.apache.log4j.Category;
import org.apache.log4j.Logger;
import org.apache.log4j.spi.LoggerFactory;

/**
 * The Class AMLogger.
 */
public class AMLogger extends Logger {

  /** The my factory. */
  private static AMLoggerFactory myFactory = new AMLoggerFactory();

  /**
   * Instantiates a new aM logger.
   * 
   * @param name the name
   */
  public AMLogger(String name) {
    super(name);
  }

  /**
   * Gets the single instance of AMLogger.
   * 
   * @param name the name
   * @return single instance of AMLogger
   */
  public static Category getInstance(String name) {
    return Logger.getLogger(name, myFactory);
  }

  /**
   * Gets the logger.
   * 
   * @param name the name
   * @return the logger
   */
  public static Logger getLogger(String name) {
    return Logger.getLogger(name, myFactory);
  }

  /**
   * A factory for creating AMLogger objects.
   */
  static class AMLoggerFactory implements LoggerFactory {

    /**
     * Instantiates a new aM logger factory.
     */
    AMLoggerFactory() {
    }

    /*
     * (non-Javadoc)
     * 
     * @see org.apache.log4j.spi.LoggerFactory#makeNewLoggerInstance(java.lang.String )
     */
    public Logger makeNewLoggerInstance(String name) {
      return new AMLogger(name);
    }

  }

}